package com.czl.elm.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "login对象",description = "")
public class UsersLoginParam implements UserDetails, Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "手机号",required = true)
    private String phoneName;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "验证码",required = true)
    private String checkCode;

    @ApiModelProperty(value = "状态")
    private Integer enable;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getUsername() {
        return phoneName;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return enable==1?true:false;
    }
}
